package datastructures;

/**
 * Systemovy zasobnik k ukladani instrukci
 * @author honzee
 */
public class SystemStack {

    private final Integer stack[];
    private int pointer = -1;

    public SystemStack(Integer stackSize) {
        this.stack = new Integer[stackSize];
    }

    public void push(Integer value) {
        pointer++;
        stack[pointer] = value;
    }

    /**
     * Vraci hodnotu z vrcholu stacku
     */
    public Integer pop() {
        Integer value = stack[pointer];
        pointer--;
        return value;
    }
}
